SOURCEDIR=$(shell pwd)

all: depend
	\cd src/C++ && $(MAKE) all
	\cp src/C++/bnb .

depend:
	\cd src/C++ && $(MAKE) depend

clean:
	\cd src/C++ && $(MAKE) clean
	\rm -f bnb

clean-all:
	$(MAKE) clean
	cd src/SDL_Layer && $(MAKE) clean && rm -f Makefile
	@echo "Don't forget to configure before next make"

# Build a .tar.gz package
dist:
	@echo "Making package for BnB version $(VERSION)"
	$(MAKE) clean-all
	\mkdir /tmp/BnB-$(VERSION)
	\cp -Rf ./* /tmp/BnB-$(VERSION)
	\find /tmp/BnB-$(VERSION) -name "*svn*" | xargs rm -Rf
	(\cd /tmp && \tar cfvz BnB-$(VERSION).tar.gz BnB-$(VERSION) 1>/dev/null && \mv BnB-$(VERSION).tar.gz $(SOURCEDIR)/.. && \rm -Rf ./BnB-$(VERSION))
	@echo "Package BnB-$(VERSION).tar.gz created at location $(SOURCEDIR)/.."

# Build a package with the currente date as
# a parameter for the name
snapshot:
	$(MAKE) dist VERSION=snapshot-$$(date +"%d%m%Y")

